Skip to content

Zig 0.16#59955

Draft
tranzystorekk wants to merge 8 commits into
void-linux:masterfrom
tranzystorekk:zig16
Draft

Zig 0.16#59955
tranzystorekk wants to merge 8 commits into
void-linux:masterfrom
tranzystorekk:zig16

Conversation

@tranzystorekk

Copy link
Copy Markdown
Contributor

Testing the changes

  • I tested the changes in this PR: YES|briefly|NO

@jonpikum

jonpikum commented Apr 25, 2026

Copy link
Copy Markdown

Please correct anything I might not have understood about this topic, but per the discussion in #60034...
It looks like river 0.4 is a pretty major break, removing both riverctl and rivertile (the actual WM part).
I think this means that any user of river will go from having a working DE with 0.3 to.. well.. not, with 0.4.
No key-binds, no way to open a new terminal window, maybe worse? IDK.

The blog post discussing the changes to river links to another page with a list of WMs that work with the new protocol.
It looks like river provides an example tinyrwm and states that the C example is canonical - however, there are no tagged releases.
Maybe this PR should could include at least one of these so that users have an option to get started with, rather than needing to compile one of these themselves? (potentially from a non-working environment)

Edit: links, verbiage, clarify tinyrwm state

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

The nature of a rolling distro means this will be a breaking change with an INSTALL.msg announcement displayed during update, but you raise some valid points:

  • we should wait for river-classic to release a zig 0.16 update to be able to provide it as a package
  • packaging at least one modern river wm seems like a prudent idea

@classabbyamp

Copy link
Copy Markdown
Member

re: river:

I've packaged and tested river with rrwm, but I don't think I'll be using it at this time. My recommendation is:

  • river WMs should depend on river>=4.4.0
  • river WMs should provides="river-wm-0_1"
  • an install message should mention installing a WM, with a link to the river wiki's list of WMs, and maybe saying you can find packaged WMs with xbps-query -Rp provides -s river-wm

@al20ov

al20ov commented May 2, 2026

Copy link
Copy Markdown
Contributor

Ghostty doesn't build either (neither the old 1.1.3 nor 1.3.1) but they're working on updating everything to zig 0.16 right now: ghostty-org/ghostty#12388

@Nizarjh

This comment was marked as off-topic.

@dkwo

dkwo commented May 9, 2026

Copy link
Copy Markdown
Contributor

On native aarch64, I worked around the waylock build failure by adding -Dllvm=true to configure_args: maybe it also helpful here with the same (cross) failure.

@classabbyamp

Copy link
Copy Markdown
Member

it has one

@Anachron

Copy link
Copy Markdown
Contributor

Yep, it was me doing stupid things. Sorry.

This was referenced May 18, 2026
@hosaka

hosaka commented May 26, 2026

Copy link
Copy Markdown
Contributor

@tranzystorekk river-classic has since received support for 0.16 - https://codeberg.org/river/river-classic/releases
edit: should have checked the diff, sorry

@kurth4cker

kurth4cker commented May 29, 2026

Copy link
Copy Markdown
Contributor

hello, what is blocking this update currently? I see every zig package have to be updated in order to keep repo stable. Is there any package or problem left?

Can I help for transitioning to zig 0.16. And how can I test if everything ok in the whole repo with new zig version?

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

currently, there are at least two open matters:

  • there's a zig 0.17 release prognosed in the near future and i'm weighing up whether to wait and see if it's reasonably backwards compatible
  • we're missing a sensible default for a river 0.4 wm so that river doesn't become a useless package on entry (tbh the river ecosystem feels too immature to commit to maintaining any of the options)

@kurth4cker

Copy link
Copy Markdown
Contributor

ok. I see now. Waiting for 0.17 makes sense.

About river, I think finding a default is just become a matter of taste. I have been using beansprout for a couple of months. It covers most of the river-classic features.

  • hide mouse pointer when typing
  • mouse acceleration settings (I'm not sure)
  • riverctl functinality to change config at live

these are missing ones in my case. I didn't look differences in default config but I think It is a good option for users. But it also requires zig 0.16 like river itself. Not a problem though.

Is your plan really provide featurefull default or let user recover from "miss launching river". By spawning a terminal or closing river? I think if exist, something like kiosk might be enough as a default.

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

i believe any sensibly working wm would serve as a foot in the door to inspire other people to package more river software, but i'd prefer something not written in zig to make it more independent from the already awful zig situation on void

@atomkarinca

Copy link
Copy Markdown

wideriver does not require zig to compile, i believe. it's been packaged for a couple distros already.

@crumpetalpaca

Copy link
Copy Markdown

wideriver does not require zig to compile, i believe. it's been packaged for a couple distros already.

Isn't wideriver only for river-classic? Since I thought the issue was that there wasn't a packages for river 0.4.0 window managers.
And I also thought that #54564 was waiting on this pull request merge.

@atomkarinca

Copy link
Copy Markdown

wideriver does not require zig to compile, i believe. it's been packaged for a couple distros already.

Isn't wideriver only for river-classic? Since I thought the issue was that there wasn't a packages for river 0.4.0 window managers. And I also thought that #54564 was waiting on this pull request merge.

sorry if that's the case. i thought river-classic had its own window manager. i checked the river website and they don't list wideriver in their window manager list. then tarazed might be a good alternative.

@jonpikum

Copy link
Copy Markdown
  • we're missing a sensible default for a river 0.4 wm so that river doesn't become a useless package on entry (tbh the river ecosystem feels too immature to commit to maintaining any of the options)

I concur.. By process of elimination, I tested rhine and zrwm locally, but neither fit my use case.

I know I previously argued in favor of having at least one river 0.4 wm packaged, but I'd like to retract that sentiment.
Perhaps in the short-term, the inclusion of river-classic is enough?
Then we could handle new river 0.4 wm's as requested/desired?
Not sure, just a suggestion..

@BratishkaErik

Copy link
Copy Markdown

One moment, let me check something...

https://codeberg.org/ziglang/translate-c/issues/409 seems like I used wrong API? but I never got these errors

@BratishkaErik

Copy link
Copy Markdown

So it seems ncurses and zstd from cross-target are being linked to native-host running translate-c, they fixed API in newer versions by introducing link_system_libs,
but it does not exist on translate-c branch for Zig 0.16.0...

For now I moved to deprecated addTranslateC. Try this:

https://github.com/BratishkaErik/ncdu/releases/tag/v2.10.1-dev.1

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

With the old translateC step, it's hard to persuade zig to find the include dir:

armv7l-linux-gnueabihf-pkg-config --list-all
armv7l-linux-gnueabihf-pkg-config ncursesw --cflags --libs
armv7l-linux-gnueabihf-pkg-config libzstd --cflags --libs
/usr/bin/zig translate-c -lc --cache-dir .zig-cache --global-cache-dir /host/zig -target arm-linux-gnueabihf -OReleaseSafe -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -L/usr/armv7l-linux-gnueabihf/usr/lib32 -lncursesw -lzstd /builddir/ncdu2-2.10.1/src/c.h --listen=-
install
+- install ncdu
   +- compile exe ncdu ReleaseSafe arm-linux-gnueabihf
      +- translate-c 2 errors
error: translation failure
/builddir/ncdu2-2.10.1/src/c.h:17:10: error: 'curses.h' not found
#include <curses.h>
         ^
error: 2 compilation errors
failed command: /usr/bin/zig translate-c -lc --cache-dir .zig-cache --global-cache-dir /host/zig -target arm-linux-gnueabihf -OReleaseSafe -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -L/usr/armv7l-linux-gnueabihf/usr/lib32 -lncursesw -lzstd /builddir/ncdu2-2.10.1/src/c.h --listen=-

Build Summary: 1/5 steps succeeded (1 failed)
install transitive failure
+- install ncdu transitive failure
   +- compile exe ncdu ReleaseSafe arm-linux-gnueabihf transitive failure
      +- translate-c 2 errors

error: the following build command failed with exit code 1:
.zig-cache/o/65749be377186433a1b15ddb3d063143/build /usr/bin/zig /usr/lib/zig /builddir/ncdu2-2.10.1 .zig-cache /host/zig --seed 0xdf75d32c -Z33876322cc1b105a -j16 --sysroot /usr/armv7l-linux-gnueabihf --search-prefix /usr/armv7l-linux-gnueabihf/usr --prefix /usr --libc xbps_zig_libc.txt --release=safe --verbose -Dtarget=arm-linux-gnueabihf -Dcpu=generic+v7a+vfp3 install -Dpie -fsys=ncurses -fsys=zstd
=> ERROR: ncdu2-2.10.1_1: do_build: 'DESTDIR="zig-out" zig build -j"${XBPS_MAKEJOBS}" --sysroot "${XBPS_CROSS_BASE}" --search-prefix "${XBPS_CROSS_BASE}/usr" --prefix /usr --global-cache-dir /host/zig --libc xbps_zig_libc.txt --release=safe --verbose -Dtarget="${zig_target}" -Dcpu="${zig_cpu}" install ${configure_args}' exited with 1
=> ERROR:   in do_build() at common/build-style/zig-build.sh:31

@BratishkaErik

Copy link
Copy Markdown

Can you try this then:
https://github.com/BratishkaErik/ncdu/releases/tag/v2.10.1-dev.9

My command worked:

PKG_CONFIG="aarch64-unknown-linux-gnu-pkg-config" zig build -fsys=zstd -fsys=ncurses -Dtarget=aarch64-linux-gnu --sysroot /home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/ --search-prefix /usr/  --libc aarch64_libc.txt

aarch64_libc.txt:

include_dir=/home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/usr/include
sys_include_dir=/home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/usr/include
crt_dir=/home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/usr/lib

msvc_lib_dir=
kernel32_lib_dir=
gcc_dir=

BTW Zig internally prepends sysroot to search-prefix automatically, so no need to add it in CLI. Or else you get:

--sysroot /home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/ --search-prefix /home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/usr/

error: warning: unable to open library directory '/home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/home/bratishkaerik/Projects/ncdu/aarch64-unknown-linux-gnu/usr/lib': FileNotFound

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

Can you try this then:

https://x0.at/Rnnz.log

Thought I'd get some results by forcing llvm/lld like river does https://codeberg.org/river/river/src/commit/d4fef528467974b9014b0bc9c47a9ea682cc8d4b/build.zig#L22
but no luck

@Duncaen Duncaen mentioned this pull request Jun 20, 2026
@DuckTapeMan35

Copy link
Copy Markdown

I don't understand the problem. Why not have a separate zig-0.13 version for older apps that require it and update the main package? I can't use the packaged zig on my own projects nor can I package/compile other applications such as fairyglade's ly with 0.13.

I don't see why forward compatibility should be sacrificed for so long because of river when it can be maintained differently

@moabeat-berlin

Copy link
Copy Markdown
Contributor

Why not have a separate zig-0.13 version for older apps that require it and update the main package?

Observing the discussions in the PR, I was wondering exactly the same. For LLVM there is also one package for each major version. Maybe I'm missing something here, that this approach cannot be applied to Zig. Given the fact that there are almost always breaking changes between the major versions still, it sounds to me like the perfect solution.

@tranzystorekk

Copy link
Copy Markdown
Contributor Author

The current Zig ecosystem in Void land is arguably in a sorry state; we have a handful of packages in various upstream maintenance quality, and the main goal for the zig package is to somehow support as much of that mess at once.

I'm against splitting zig into versioned subpackages, as that's a sure way to even more chaos, e.g. when packages eventually start jumping zig versions and the old zig subpackages become obsolete leftovers. This is especially true for toolchains dependent on LLVM such as Zig.

On a side note, that makes me very unwilling to accept new zig packages like ly - I really want to contain and minimize the size of the Zig ecosystem in the long term i.e. until the language becomes meaningfully stable.

@BratishkaErik

BratishkaErik commented Jun 23, 2026

Copy link
Copy Markdown

https://github.com/BratishkaErik/ncdu/releases/tag/v2.10.1-dev.10

Also I tried to make simple Dockerfile for test:

# STAGE 1: THE BUILD ENVIRONMENT (Runs on host architecture, e.g., x86_64)
FROM --platform=$BUILDPLATFORM alpine:3.24 AS builder

WORKDIR /build

ARG SYSROOT="/usr/aarch64-linux-musl"

# 1. Install Zig 0.16.0, and stuff for downloading and unpacking NCDU sources
RUN apk add --no-cache zig git

# 2. Set up cross-target environment
RUN apk add --no-cache \
	--initdb \
	--root "${SYSROOT}" \
	--repositories-file /etc/apk/repositories \
	--allow-untrusted \
	--arch aarch64 \
	musl-dev ncurses-dev zstd-dev

# 3. Download and unpack NCDU sources
RUN git clone --depth=1 https://github.com/BratishkaErik/ncdu /build/ncdu

WORKDIR /build/ncdu

# 4. Generate target-architecture specs file for Zig
RUN cat <<EOF > aarch64_libc.txt
include_dir=${SYSROOT}/usr/include
sys_include_dir=${SYSROOT}/usr/include
crt_dir=${SYSROOT}/usr/lib
msvc_lib_dir=
kernel32_lib_dir=
gcc_dir=
EOF

# 5. Compile NCDU
# NOTE: --sysroot is prepended to --search-prefix value by Zig!
# But not to libc paths above...
RUN zig build \
	-fsys=zstd \
	-fsys=ncurses \
	-Dtarget=aarch64-linux-musl \
	--sysroot "${SYSROOT}/" \
	--search-prefix /usr \
	--libc aarch64_libc.txt \
	-Doptimize=ReleaseSafe \
	-Dstrip -Dpie

# STAGE 2: AArch64 runtime
# Needs emulation support enabled for containers
FROM --platform=linux/arm64 ghcr.io/void-linux/void-musl:latest

WORKDIR /app

RUN xbps-install -Syu && xbps-install -y \
	ncurses \
	libzstd \
	file

COPY --from=builder /build/ncdu/zig-out/bin/ncdu /app/ncdu

CMD ["/bin/sh"]

Running:

docker buildx build --load -t ncdu-isolated-test .

docker run --rm -it ncdu-isolated-test                            01:13:15
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested
# ls
ncdu
# file ncdu
ncdu: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, stripped
# ./ncdu -o json.export
# file json.export
json.export: JSON text data
# cat json.export
[1,2,{"progname":"ncdu","progver":"2.10.1-dev","timestamp":1782245604},
[{"name":"/app","asize":4096,"dsize":4096},
{"name":"json.export"},
{"name":"ncdu","asize":437640,"dsize":438272}]]
#

P.S.: Dockerfile should be saved in LF, otherwise https://codeberg.org/ziglang/zig/issues/35906 will appear

@dm17

dm17 commented Jun 25, 2026

Copy link
Copy Markdown

Due to the above difficulties, I see no reason why the words of Andrew Kelley should not be included & considered:
image

@hosaka

hosaka commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

I don't see why we can't package separate Zig versions like we do for LLVM. What chaos are you referring to exactly? At least this would address the current problem in void-packages. Older versions don't even need to be maintained and can slowly fade away as projects move onwards with updating their Zig dependency.

@BratishkaErik BratishkaErik mentioned this pull request Jun 30, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.